<div
  *ngIf="playlist && currentPlaylistPosition" class="playlist"
  myInfiniteScroller [autoInit]="true" [onItself]="true" (nearOfBottom)="onPlaylistVideosNearOfBottom()"
>
  <div class="playlist-info">
    <div class="playlist-display-name">
      {{ playlist.displayName }}

      <span *ngIf="isUnlistedPlaylist()" class="badge badge-warning" i18n>Unlisted</span>
      <span *ngIf="isPrivatePlaylist()" class="badge badge-danger" i18n>Private</span>
      <span *ngIf="isPublicPlaylist()" class="badge badge-info" i18n>Public</span>
    </div>

    <div class="playlist-by-index">
      <div class="playlist-by">{{ playlist.ownerBy }}</div>
      <div class="playlist-index">
        <span>{{ currentPlaylistPosition }}</span><span>{{ playlistPagination.totalItems }}</span>
      </div>
    </div>

    <div class="playlist-controls">
      <my-global-icon
        iconName="videos"
        [class.active]="autoPlayNextVideoPlaylist"
        (click)="switchAutoPlayNextVideoPlaylist()"
        [ngbTooltip]="autoPlayNextVideoPlaylistSwitchText"
        placement="bottom auto"
        container="body"
      ></my-global-icon>

      <my-global-icon
        iconName="repeat"
        [class.active]="loopPlaylist"
        (click)="switchLoopPlaylist()"
        [ngbTooltip]="loopPlaylistSwitchText"
        placement="bottom auto"
        container="body"
      ></my-global-icon>
    </div>
  </div>

  <div *ngFor="let playlistElement of playlistElements" [ngClass]="'element-' + playlistElement.position">
    <my-video-playlist-element-miniature
      [playlistElement]="playlistElement" [playlist]="playlist" [owned]="isPlaylistOwned()" (elementRemoved)="onElementRemoved($event)"
      [playing]="currentPlaylistPosition === playlistElement.position" [accountLink]="false" [position]="playlistElement.position"
      [touchScreenEditButton]="true"
    ></my-video-playlist-element-miniature>
  </div>
</div>
